#include"TwoWayAdapter.h"

void TwoWay::result(string SocketType, string PlugType){
	if (SocketType == "CN" && PlugType == "US") {
		unique_ptr<USplug>usPlug(new USplug);
		CNsocket* cnSocket = new CNsocket();
		Adapter* adapter = new Adapter(cnSocket);
		usPlug->UseUSplug(adapter);
		usPlug->UseUSvol(adapter);
		delete cnSocket;
		delete adapter;
	}
	else if (SocketType == "US" && PlugType == "CN") {
		unique_ptr<CNplug>cnPlug(new CNplug);
		USsocket* usSocket = new USsocket();
		Adapter* adapter = new Adapter(usSocket);
		cnPlug->UseCNplug(adapter);
		cnPlug->UseCNvol(adapter);
		delete usSocket;
		delete adapter;
	}
	else if ((SocketType == "CN" && PlugType == "CN") || (SocketType == "US" && PlugType == "US")) {
		cout << "No need to use Adapter" << endl;
	}
	else {
		cout << "error" << endl;
	}
}